package org.ht.viewer;

import java.util.HashMap;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class IconUtil {
	static private final String URL = "./resouce/";

	static private HashMap<String, Icon> icons = new HashMap<String, Icon>();

	static IconUtil singleton = new IconUtil();

	public IconUtil() {
		init();
	}

	/**
	 * 初始化
	 */
	static public void init() {
		addIcon("add.jpg");
		addIcon("sub.jpg");
		addIcon("clear.jpg");
		addIcon("look.jpg");
	}

	static public void addIcon(String name) {
		Icon icon = new ImageIcon(URL + name);
		icons.put(name, icon);
	}

	public static Icon getIcon(String name) {
		return icons.get(name);
	}
}
